package thread1;


public class demo1 {

    public static void main(String[] args) {

        T1 t1 = new T1();
        t1.setName("t1");
        t1.start();
        System.out.println(Thread.currentThread().getName());

        Run1 run1 = new Run1();
        new Thread(run1).start();


    }
}

class T1 extends Thread {
    @Override
    public void run() {
        try {
            Thread.sleep(800);
            System.out.println(Thread.currentThread().getName());
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
}
class Run1 implements Runnable {

    @Override
    public void run() {
        System.out.println("run1 running");
    }
}
